package com.yunmang.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.yunmang.R;
import com.yunmang.entity.FahuoStatictics;
import com.yunmang.entity.SignStatictics;
import com.yunmang.utils.ViewHolderUtils;

import java.util.List;

/**
 * Created by Administrator on 2017/6/28.
 */
public class SendAdapter extends BaseAdapter {
    private Context context;
    private List<FahuoStatictics.ModelBean> dataList;
    public SendAdapter(Context context, List<FahuoStatictics.ModelBean> dataList){
        this.context=context;
        this.dataList=dataList;
    }
    @Override
    public int getCount() {
        return dataList.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup viewGroup) {
        FahuoStatictics.ModelBean modelBean = dataList.get(i);
        if(convertView==null)
            convertView=View.inflate(context, R.layout.title_statictics_send,null);
        TextView tv_depname = ViewHolderUtils.get(convertView, R.id.tv_depname);
        TextView tv_num_piaoshu = ViewHolderUtils.get(convertView, R.id.tv_num_piaoshu);
        TextView tv_yunfei = ViewHolderUtils.get(convertView, R.id.tv_yunfei);
        TextView tv_xianfu = ViewHolderUtils.get(convertView, R.id.tv_xianfu);
        TextView tv_daofu = ViewHolderUtils.get(convertView, R.id.tv_daofu);
        TextView tv_collect_money = ViewHolderUtils.get(convertView, R.id.tv_collect_money);
        TextView tv_huidan_moeny = ViewHolderUtils.get(convertView, R.id.tv_huidan_moeny);
        TextView tv_koufu_money = ViewHolderUtils.get(convertView, R.id.tv_koufu_money);
        TextView tv_money_month = ViewHolderUtils.get(convertView, R.id.tv_money_month);
        TextView tv_shf = ViewHolderUtils.get(convertView, R.id.tv_shf);
        tv_depname.setText(modelBean.getDepartName());
        tv_num_piaoshu.setText(modelBean.getBillCount() + "");
        tv_yunfei.setText(modelBean.getTransportCost() + "");
        tv_xianfu.setText(modelBean.getTransportCostByShipper() + "");
        tv_daofu.setText(modelBean.getTransportCostByConsignee() + "");
        tv_collect_money.setText(modelBean.getGoodsCost() + "");
        tv_huidan_moeny.setText(modelBean.getTransportCostByDeliveryProof() + "");
        tv_koufu_money.setText(modelBean.getTransportCostByUnpaid() + "");
        tv_shf.setText(modelBean.getDeliveryCost() + "");
        tv_money_month.setText(modelBean.getTransportCostByMonthly()+ "");
        return convertView;
    }
    public void refresh(List<FahuoStatictics.ModelBean> dataList){
        this.dataList=dataList;
        notifyDataSetChanged();
    }

}
